Repository navigation
fix: omp one-shot (-p) first request claims plugin mode — await identity registration before dispatch - #1237
Merged
Conversation
…ity registration before dispatch (#1230) Mirror #1228 on the before_provider_request path: make the handler async and await registerTools before stamping/reporting. omp's runner awaits async handlers and sends the resolved payload (verified in the omp 18.0.3 dist), so the plugin-mode claim (the identity:true register that runs INSIDE registerTools, after the manifest fetch) now serializes ahead of the single -p dispatch instead of racing it. A losing race bound the session as an anonymous pfa-*/proxy-mode session with no round 2 to self-heal.
Contributor
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1237Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1237.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Owner
Author
[bot] 🏷 Reviewing this PR now — pulling the branch ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1230
What changed
Mirror of #1228 on the
before_provider_requestpath (src/agent/pi.ts, shared by theompandpiplugin entries): the handler is nowasyncand awaitsregisterToolsbefore reporting runtime info and returning the stamped payload, instead of firing it off withvoid … .catch(…).For omp the plugin-mode claim is the identity registration (
POST /__bili/plugin/registerwithidentity: true) that runs insideregisterTools, after the manifest fetch. omp's extension runner awaits async handlers and sends the resolved value as the outgoing payload (verified in the installed omp 18.0.3 dist:emitBeforeProviderRequestawaits each handler; its 30s handler-timeout guard is well above the worst-case hold), so the register now provably lands on the proxy before the request leaves. The proxy binds by that id at request time (consumePluginRegisterFor,src/server.ts) — there is no retroactive upgrade, so order is everything for a one-shot.Behavior change (intended, flagged per policy)
omp -pcase), the session bound as an anonymouspfa-*in proxy mode forever. New: the first request waits at most ~manifest-fetch timeout (5s) + identity-register timeout (5s); subsequent requests are instant (sid-cached / pending-deduped / 10s-throttled). A permanently failing manifest fetch still degrades to wire mode (graceful, unchanged).bili omp -p '<prompt>'binds its single dispatch into plugin mode — ACP compression contract +/acpbinding by session id — instead of silently running proxy mode. TUI behavior is semantically unchanged (it already self-healed on round 2); round 1 simply no longer rides wire mode.toolsReadyflipped, so the first request reported nothing and the report rode round 2+; new — the report fires during round 1's handler await, i.e. alongside the first request. Same dedup semantics (per model switch), one earlier POST in TUI sessions.before_provider_headershook (already awaiting since fix: pi one-shot (-p) first request claims plugin mode — await tool registration before header stamp #1228) runs first and completes registration, so the request hook's await returns instantly from the sid cache. If a pi build ever emits onlybefore_provider_request, it now gets the same bounded serialization as omp instead of fire-and-forget.Why not land #1216 instead
#1216 gates both hooks behind a 5s readiness wait, but (a) it predates #1228 — its pi-header gate would rewrite shipped behavior and conflict on rebase, and (b) its gate releases when
toolsReadyflips, which happens insideregisterToolsbeforepostIdentityRegister— so for omp the gate does not serialize behind the identity register and does not fully close this race. Recommend closing #1216 as superseded (owner call).Verification
#1230: before_provider_request awaits identity registration — omp one-shot (-p) first dispatch claims plugin mode: drives the hook once with nosession_startprewarm and asserts the identity register has landed at handler-resolution time (no polling) plus payload stamping and no duplicate register on a second fire. Proven red on pre-fix code (fails with the fix stashed), green with it.fakeCtx(undefined)keeps registration a no-op so they stay pure).#957runtime-info test expectation updated to the new round-1 reporting (see above).db52a965): typecheck ✅ ·tests/plugin-agent.test.ts48/48 ✅ · full suite 2385/2390 — the 3 failures are claude-native e2e tests that fail identically on clean master in this environment (spawn/ps-walk sandbox issues, verified by stash-and-rerun) ✅ · tsup build ✅